UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Uy4s/fhhm0zvqIuBXx5DZuc3v2lIzAUUVnfhREb7NxA=' 
WHERE 
  key_id = '917a15518ed2b1f30b4cad74346832a09b56126367a55e3012924bd60da07fbe' 
  AND (
    token = 'Uy4s/fhhm0zvqIuBXx5DZuc3v2lIzAUUVnfhREb7NxA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033