UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GyJvcsJMm6NHl/HdmFeIIHXBgtV0xYCetEhloR/ghl0=' 
WHERE 
  key_id = '240b7a3df6ad00c9c1faeacee3242c64bbdd242ad9075cfecf95818087bd22a1' 
  AND (
    token = 'GyJvcsJMm6NHl/HdmFeIIHXBgtV0xYCetEhloR/ghl0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032