UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ee6MbDFNdUgh4tox7lzFy28DbL2cg8JaTMK+jOPwzX0=' 
WHERE 
  key_id = '57392f06970ace8906ea99630e646190b74cc929c3e57e3fde9fc87896f9b2cc' 
  AND (
    token = 'ee6MbDFNdUgh4tox7lzFy28DbL2cg8JaTMK+jOPwzX0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029