UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZDFqjaiM5x5tYhrQdYfe1EHcqufJvFgSA+ZxntRnxfE=' 
WHERE 
  key_id = '34cd59104adee77c62bc3782b14e9bac87b1a903ba7783be957d9e7b34377c58' 
  AND (
    token = 'ZDFqjaiM5x5tYhrQdYfe1EHcqufJvFgSA+ZxntRnxfE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027