UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ByqiiIOuLyaWXqTSyCfwfofLKPcCgghj6e+JyLkvGN4=' 
WHERE 
  key_id = '6a54765bb29262c07ed6b3a708ef50b1ccd461b20ddfaf9ab389e68203eb641d' 
  AND (
    token = 'ByqiiIOuLyaWXqTSyCfwfofLKPcCgghj6e+JyLkvGN4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048