UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v4GEsZjc6Jl1WkcAjEzC/6mgamS80/8+4aKsdy8ttqs=' 
WHERE 
  key_id = '266a420633d0d6b512e4196f907b32bc835da7ff506a75cd686ad5c1cc71f02d' 
  AND (
    token = 'v4GEsZjc6Jl1WkcAjEzC/6mgamS80/8+4aKsdy8ttqs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027