UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TdU9wHdTwVKXZne/tYAVmpH75f6P2ft9DOM2Rryx9Eo=' 
WHERE 
  key_id = '9a91a56fca9556307fc460e2bf174fa8528d5312433f3b73276678a18272f550' 
  AND (
    token = 'TdU9wHdTwVKXZne/tYAVmpH75f6P2ft9DOM2Rryx9Eo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016