UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PmKyc82mbnBDBodQHKkjbB6x5Ci61w1Xy4AeWVA+eUY=' 
WHERE 
  key_id = 'df2b9a17f3985b6d4f6b22665f7e683f5302a5bab71589a55bf0534bbeb14052' 
  AND (
    token = 'PmKyc82mbnBDBodQHKkjbB6x5Ci61w1Xy4AeWVA+eUY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043