UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cIuXQPsdHs96agjfmWuRDVD6uI3aOI008Oo+yLxmkOI=' 
WHERE 
  key_id = '7f4b4276e6ee1549ced68f7a7ed9826e2971d7802e78f6281f531762532aa35b' 
  AND (
    token = 'cIuXQPsdHs96agjfmWuRDVD6uI3aOI008Oo+yLxmkOI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039