UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N/+7aw/F5hfUd78z962HyTYDPazJv072IN1pTB/pe6Y=' 
WHERE 
  key_id = 'fab1a792854ae3b8dd6b699edc8764faaac854b75b4e0d51b3690d04f8790b63' 
  AND (
    token = 'N/+7aw/F5hfUd78z962HyTYDPazJv072IN1pTB/pe6Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031