UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YJGFo7z26/MUwxBmOKkPzxO2LM0oRtIvg88tet4wjcA=' 
WHERE 
  key_id = '871adecbcdc980ac1fc31f27d51e0ea5e4c111379e4d2818ffc682e89b4f9f25' 
  AND (
    token = 'YJGFo7z26/MUwxBmOKkPzxO2LM0oRtIvg88tet4wjcA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037