UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dSacHpsCdCrKUlHmY6W49J6WwUcJ7yBWtc6aJ7BfcPA=' 
WHERE 
  key_id = 'da2b10bbfef23b2cad190462294851cb57ea4634fd3e0bc1b024143842f1d5f7' 
  AND (
    token = 'dSacHpsCdCrKUlHmY6W49J6WwUcJ7yBWtc6aJ7BfcPA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025