UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eDQZF1H6HFP1/CI7I58kvdfmRCT6pk1WfMqXP1qb6fQ=' 
WHERE 
  key_id = '9e2d783f32d792cfc3516a3ac2e306c7836f1f7d9c2e3960e415075cae841396' 
  AND (
    token = 'eDQZF1H6HFP1/CI7I58kvdfmRCT6pk1WfMqXP1qb6fQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026