UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LdsEgwPjka22xDcEtzTAgjmCknnIrurTQSYzjrIIEJk=' 
WHERE 
  key_id = '042ac4e67d0d4d2af9d50c086472c6bc62bad955b289459f7d11482ef6e9c622' 
  AND (
    token = 'LdsEgwPjka22xDcEtzTAgjmCknnIrurTQSYzjrIIEJk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032