UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Za6O81T2vLX7DQZiwQFlHLK/ktRiZU7DthdDByXc3bs=' 
WHERE 
  key_id = '6686c7bd554bdb0d2f3e1f07e528475acf47054e03faa8e36639e5db865f91be' 
  AND (
    token = 'Za6O81T2vLX7DQZiwQFlHLK/ktRiZU7DthdDByXc3bs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042