UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g1tbvs5tqSba+HC8wCnv3XZMxlsLv4wRaIKQCPpriU4=' 
WHERE 
  key_id = '8d469e04bdb8313db462b1e827a52cd6093a6091788668e49e25426e88ef997c' 
  AND (
    token = 'g1tbvs5tqSba+HC8wCnv3XZMxlsLv4wRaIKQCPpriU4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034