UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TrAxxyI1wy50DFLLLGSrzCrLaNbdNHALDw0mOnO8c1Q=' 
WHERE 
  key_id = '1c2913212ada8d9a45ac1a7b36666876745bef3a28b0731300863c2717c85dec' 
  AND (
    token = 'TrAxxyI1wy50DFLLLGSrzCrLaNbdNHALDw0mOnO8c1Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055