UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'khg/yca3oClhMnCzNN3N6UNB1anowilw8xllg4bxiLA=' 
WHERE 
  key_id = '6957d8075dae7d0b9730514a6be0b084969bd1d806c45f8051319e1bcedf935e' 
  AND (
    token = 'khg/yca3oClhMnCzNN3N6UNB1anowilw8xllg4bxiLA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026