UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0N+vGt8E0JyfiondjJb94Y86oTnWbEd4SMao2dFkOdE=' 
WHERE 
  key_id = '007357fbff887957a484abe5be91498987042bba23ef0f9eb2ff69f195c3186b' 
  AND (
    token = '0N+vGt8E0JyfiondjJb94Y86oTnWbEd4SMao2dFkOdE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034