UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g8Xz8bZBrQiSUnTGwiYUA1rv0Q/EQTl1CG/zrt4a9pQ=' 
WHERE 
  key_id = '0ded22195073d94202ac30a0969064c9af5e729318ec8d4a09851bb679940a2b' 
  AND (
    token = 'g8Xz8bZBrQiSUnTGwiYUA1rv0Q/EQTl1CG/zrt4a9pQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046