UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xG1FBS3hOOI0S6uTbimp8f3ZfkaSlVrqCRn54Z6H/Wo=' 
WHERE 
  key_id = '96b0b80f2c67d7758612570d07772d8aa80a382802f2696ff3e78de6023d775d' 
  AND (
    token = 'xG1FBS3hOOI0S6uTbimp8f3ZfkaSlVrqCRn54Z6H/Wo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040