UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mKVgKb067bRj/4tOH0yO/4vJ+HX68Ac1a2dNym1+laY=' 
WHERE 
  key_id = '70425f0f41190845a60af9976451e13fbfe59311c4012db78266f85618891436' 
  AND (
    token = 'mKVgKb067bRj/4tOH0yO/4vJ+HX68Ac1a2dNym1+laY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040