UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NMuXeEqbR3T1dyxXf2///MsmgANX+MyXmayWYIOfyYg=' 
WHERE 
  key_id = '9649a961ccc243726dd8a1e754dbc66618d17baedf3b3a487e83cef55a9378a0' 
  AND (
    token = 'NMuXeEqbR3T1dyxXf2///MsmgANX+MyXmayWYIOfyYg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062