UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'l23OUPnaqJ/VRq0RXv8+RqFgMJefn3h+O1acoCBHBbE=' 
WHERE 
  key_id = '9fe0c288c52b58379d25c27b244109a29562b82045fc7217597ed9dc73b2900b' 
  AND (
    token = 'l23OUPnaqJ/VRq0RXv8+RqFgMJefn3h+O1acoCBHBbE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029