UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iLgrmF4+u54OaRu0cmirAwFTge/pRjTsx54QbZf/8oc=' 
WHERE 
  key_id = '0235cef895b256500730978f9401520b6743696e98eb9f219f3fd5c8d7232788' 
  AND (
    token = 'iLgrmF4+u54OaRu0cmirAwFTge/pRjTsx54QbZf/8oc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042