UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uoR/zRQ+kCjI8k7JJ8r3A8j90hloF+ROV6y1Hp1fYKs=' 
WHERE 
  key_id = '695cfada8f62b0b8df9a590999149624f168e97f5df0d14b14276db4f729629e' 
  AND (
    token = 'uoR/zRQ+kCjI8k7JJ8r3A8j90hloF+ROV6y1Hp1fYKs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023