UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6XRsTuDc/k8/c6EiVKzmCAx9f9IXvZc/uzWWywskYQ0=' 
WHERE 
  key_id = '7750d3681c6f3c1e5d57676ba81ca0d71c80c5b2dcdbb2f269355eea67c16dd6' 
  AND (
    token = '6XRsTuDc/k8/c6EiVKzmCAx9f9IXvZc/uzWWywskYQ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035